import request from "@/utils/request";

// 获取合同用印管理列表
export function getSealListApi(query, data) {
  return request({
    url: "/system/purContract/list",
    method: "post",
    params: query,
    data,
  });
}

// 获取合同用印管理列表
export function getRawSealListApi(query, data) {
  return request({
    url: "/system/purContract/selectPurFrametInfoList",
    method: "post",
    params: query,
    data,
  });
}

// 获取原合同列表2
export function getSourceContract(params) {
  return request({
    url: `/system/purContract/selectPurContractReplenishList`,
    method: "get",
    params
  });
}

// 获取合同用印审核列表
export function getCheckSealList(query, data) {
  return request({
    url: "/system/purContract/selectCheckPurContractList",
    method: "post",
    params: query,
    data,
  });
}

// 获取项目列表
export function getProjectListApi() {
  return request({
    url: `/system/project/selectProjectEchoList`,
    method: "get",
  });
}

// 获取框架协议列表
export function getFrameListApi(query, data) {
  return request({
    url: "/system/purContract/selectPurFrametList",
    method: "post",
    params: query,
    data,
  });
}

// 获取框架协议下拉框列表
export function getFrameSelectListApi(supplierId) {
  return request({
    url: "/system/purContract/selectPurFrameListBySupplier",
    method: "get",
    params: { supplierId },
  });
}

// 获取框架协议明细
export function getFrameDetailListApi(purchaseContractId) {
  return request({
    url: "/system/purContract/queryConMaterById",
    method: "get",
    params: { purchaseContractId },
  });
}

// 获取合同用印到票列表
export function getTicketListApi(purchaseContractId) {
  return request({
    url: "/system/conInvoice/selectInvoceDetails",
    method: "get",
    params: { purchaseContractId },
  });
}

// 获取合同用印入库列表
export function getInorderListApi(relationContractId) {
  return request({
    url: "/system/purContract/selectWarehouseListByConId",
    method: "get",
    params: { relationContractId },
  });
}

// 获取采购订单列表
export function getOrderListApi(params) {
  return request({
    url: `/system/purContract/selectOrderInfoPrivilege`,
    method: "get",
    params
  });
}

// 根据合同类型和采购单ID获取采购单物料列表
export function getOrderMaterialApi(data) {
  return request({
    url: "/system/purContract/selectOrderMaterialList",
    method: "post",
    data,
  });
}

// 根据采购订单获取请购单数据
export function getRequestListApi(data) {
  return request({
    url: "/system/purContract/selectErpMaterial",
    method: "post",
    data,
  });
}

export function getRequestAllListApi(data) {
  return request({
    url: "/system/purContract/selectErpMaterialList",
    method: "post",
    data,
  });
}

export function getRequestFilterListApi(data) {
  return request({
    url: "/system/purContract/selectErpMaterialAllList",
    method: "post",
    data:{}
  });
}


// 新增合同用印
export function addSealApi(data) {
  return request({
    url: "/system/purContract/add",
    method: "post",
    data,
  });
}

// 新增框架
export function addFrameApi(data) {
  return request({
    url: "/system/purContract/addFrame",
    method: "post",
    data,
  });
}

// 编辑框架
export function editFrameApi(data) {
  return request({
    url: "/system/purContract/editFrame",
    method: "post",
    data,
  });
}

// 新增到票
export function addTicketApi(data) {
  return request({
    url: "/system/conInvoice/add",
    method: "post",
    data,
  });
}

// 编辑到票
export function editTicketApi(data) {
    return request({
      url: "/system/conInvoice/edit",
      method: "post",
      data,
    });
  }

// 编辑合同用印
export function editSealApi(data) {
  return request({
    url: "/system/purContract/edit",
    method: "post",
    data,
  });
}

// 编辑合同用印
export function cancelSealApi(data) {
  return request({
    url: "/system/purContract/cancel",
    method: "post",
    data,
  });
}

// 获取合同用印详情
export function getSealDetailApi(purchaseContractId) {
  return request({
    url: `/system/purContract/getInfo`,
    method: "get",
    params: { purchaseContractId },
  });
}

// 获取合同用印详情
export function getFrameDetailApi(purchaseContractId) {
  return request({
    url: `/system/purContract/selectErpPurchaseFrameInfo`,
    method: "get",
    params: { purchaseContractId },
  });
}

// 删除合同用印
export function deleteSealId(purchaseContractId) {
  return request({
    url: `/system/purContract/del`,
    method: "get",
    params: { purchaseContractId },
  });
}

// 删除框架协议
export function deleteFrameId(purchaseContractId) {
  return request({
    url: `/system/purContract/removeFrame`,
    method: "get",
    params: { purchaseContractId },
  });
}

// 审核
export function checkSealApi(data) {
  return request({
    url: "/system/purContract/checkErpOrder",
    method: "post",
    data,
  });
}

// 导出采购合同信息列表
export function exportSeal(data) {
  return request({
    url: "/system/purContract/export",
    method: "post",
    data,
  });
}

// 导出采购合同信息明细列表
export function exportSealDetail(data) {
  return request({
    url: "/system/purContract/exportDetail",
    method: "post",
    data,
  });
}

// 获取入库列表
export function getStoreListApi() {
  return request({
    url: "/system/conInvoice/selectWarehouseInfoList",
    method: "get",
  });
}

// 获取到票详情
export function getTicketDetailApi(contractRelationInvoiceId) {
  return request({
    url: `/system/conInvoice/selectInvoceDetailsInfo`,
    method: "get",
    params: { contractRelationInvoiceId },
  });
}

// 删除到票
export function deleteTicketApi(contractRelationInvoiceId) {
  return request({
    url: `/system/conInvoice/remove`,
    method: "get",
    params: { contractRelationInvoiceId },
  });
}

// 审核进度
export function selectAuditList(deliveryApplyId) {
  return request({
    url: `/system/purContract/selectAuditList`,
    method: "get",
    params: { deliveryApplyId },
  });
}
